{% extends 'cms/base.html' %}

{% block title %}
轮播图管理
{% endblock %}

{% block head %}
    <link rel="stylesheet" href="{% static 'css/cms/cms_banners.min.css' %}">
    <script src="{% static 'arttemplate/template-web.js' %}"></script>
    <script src="{% static 'js/cms_banners.js' %}"></script>
{% endblock %}

{% block content-header %}
<h1>轮播图管理</h1>
{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-12">
        <div class="btn-group">
            <button class="btn btn-primary add-banner-btn">
                <i class="fa fa-plus"></i>
                添加轮播图
            </button>
        </div>
        <ul class="tips">
            <li>支持JPG,GIF,PNG格式，最多可上传6张</li>
            <li>比例4:1，宽度800px以上，大小5M以内</li>
        </ul>
    </div>
</div>
<div class="banner-list-group"></div>

{# 添加发布轮播图的标签  #}
<script id="banner-item" type="text/html">
    {% verbatim %}
    {{ if banner }}
        <div class="box banner-item" data-banner-id="{{ banner.id }}">
    {{ else }}
        <div class="box banner-item">
    {{ /if }}
            <div class="box-header">
                {{ if banner }}
                    <span class="priority">优先级：{{ banner.priority }}</span>
                {{ else }}
                    <span class="priority">优先级：0</span>
                {{ /if }}
                <button class="btn btn-danger btn-xs pull-right close-btn">
                    <i class="fa fa-close"></i>
                </button>
            </div>
            <div class="box-body">
                <div class="thumbnail-group">
                    <input type="file" class="image-input" style="display: none" >
                    {{ if banner }}
                        <img src="{{ banner.image_url }}" alt="" class="thumbnail">
                    {{ else }}
                        <img src="/static/images/banner.png" alt="" class="thumbnail">
                    {{ /if }}
                </div>
                <div class="more-group">
                    <div class="form-group">
                        {{ if banner }}
                            <input type="number" class="form-control" name="priority" value="{{ banner.priority }}">
                        {{ else }}
                            <input type="number" class="form-control" name="priority" placeholder="请选择图片优先级">
                        {{ /if }}
                    </div>
                    <div class="form-group">
                        {{ if banner }}
                            <input type="text" class="form-control" name="link_to" value="{{ banner.link_to }}">
                        {{ else }}
                            <input type="text" class="form-control" name="link_to" placeholder="请输入跳转地址">
                        {{ /if }}
                    </div>
                </div>

            </div>
            <div class="box-footer">
                {{ if banner }}
                    <button class="btn btn-danger pull-right save-btn">修改</button>
                {{ else }}
                    <button class="btn btn-primary pull-right save-btn">添加</button>
                {{ /if }}
            </div>
        </div>
    {% endverbatim %}
</script>
{% endblock %}